pub fn convert_base(num_str: &str, to_base: u32) -> String {
    let parts: Vec<&str> = num_str.split('(').collect();
    let number_part = parts[0];
    let from_base_str = &parts[1][..parts[1].len() - 1];
    let from_base: u32 = from_base_str.parse().unwrap();
    let decimal_value = u32::from_str_radix(number_part, from_base).unwrap();

    let mut result = String::new();
    let mut n = decimal_value;

    if n == 0 {
        return "0".to_string();
    }

    while n > 0 {
        let remainder = n % to_base;
        let digit = if remainder < 10 {
            (b'0' + remainder as u8) as char
        } else {
            (b'a' + remainder as u8 - 10) as char
        };
        result.push(digit);
        n /= to_base;
    }

    result.chars().rev().collect()
}
